日期: 2025年9月14日 星期日
雲端天氣: 伺服器運作良好
心情: 沒搞清楚狀況的丟臉感
親愛的日記:
今天一家醫院找我幫忙寫訂單系統,我超開心的!終於有機會展現我的電商系統經驗了。結果...我把處方箋當成購物車,還加了買三送一的功能!
醫生說要「開立醫囑」,我理解成「建立訂單」。護理師說要「配藥」,我理解成「揀貨」。病人要「領藥」,我理解成「取貨」。聽起來很合理對吧?但完全不是這麼一回事啊!
class MedicalOrderSystem:
def __init__(self):
self.shopping_cart = [] # 購物車思維
self.discount_rules = { # 促銷邏輯
"first_time": 0.88,
"buy_3_get_1": True,
"member_points": True
}
def add_prescription(self, prescription):
"""把處方當成商品加入購物車"""
# 檢查庫存
if self.check_inventory(prescription["medicine"]):
self.shopping_cart.append({
"item": prescription["medicine"],
"price": self.get_price(prescription["medicine"]),
"quantity": prescription["dosage"]
})
# 首購優惠
if self.is_first_order(prescription["patient"]):
self.apply_discount(0.88)
# 滿額免運
if self.calculate_total() > 500:
self.free_shipping = True
# 推薦相關商品
self.recommend_related_items(prescription["medicine"])
def checkout(self):
"""結帳流程"""
total = self.calculate_total()
# 使用優惠券
if hasattr(self, 'coupon_code'):
total *= 0.9
# 累積點數
self.add_member_points(total)
return {
"total": total,
"estimated_delivery": "3-5個工作天",
"tracking_number": self.generate_tracking()
}
當醫院的資深工程師看到我的程式碼時,他深吸了一口氣,然後耐心地教導我:
# 正確的醫療處方系統
class MedicalPrescriptionSystem:
def __init__(self):
self.medical_records = []
self.regulatory_compliance = {
"controlled_substances": True,
"prescription_validation": True,
"audit_trail": True
}
def process_prescription(self, prescription, patient):
"""
處理醫療處方的正確流程
重點:這不是購物,是醫療行為!
"""
# 1. 驗證處方合法性
if not self.validate_prescription_source(prescription):
raise ValueError("處方必須來自合格醫師")
# 2. 檢查病患過敏史
allergies = self.check_patient_allergies(patient)
if self.has_allergy_conflict(prescription, allergies):
return self.alert_physician(prescription, allergies)
# 3. 藥物交互作用檢查
current_medications = self.get_current_medications(patient)
interactions = self.check_drug_interactions(
prescription["medications"],
current_medications
)
if interactions:
return self.require_physician_confirmation(interactions)
# 4. 管制藥品特殊處理
if self.is_controlled_substance(prescription):
self.verify_special_prescription_form(prescription)
self.record_in_narcotics_log(prescription, patient)
# 5. 記錄用藥歷史(不能刪除!)
self.create_immutable_record({
"prescription_id": prescription["id"],
"physician": prescription["physician"],
"patient": patient["id"],
"medications": prescription["medications"],
"timestamp": self.get_timestamp(),
"dispensed_by": None, # 待藥師確認
"legal_requirement": "保存至少3年"
})
def dispense_medication(self, prescription, pharmacist):
"""藥師配藥流程"""
# 雙重確認機制
if not pharmacist["is_licensed"]:
raise PermissionError("需要合格藥師執行")
# 標示警語
warnings = self.generate_medication_warnings(prescription)
# 用藥指導
instructions = self.create_patient_instructions(prescription)
return {
"medication": prescription["medications"],
"warnings": warnings,
"instructions": instructions,
"pharmacist": pharmacist["license_number"],
"dispensed_time": self.get_timestamp()
}
電商系統 | 醫療系統 |
---|---|
可以促銷打折 | 藥品價格受法規管制 |
追求銷售額 | 追求用藥安全 |
客戶永遠是對的 | 醫師專業判斷優先 |
可以退換貨 | 藥品不可退換 |
推薦相關商品 | 嚴禁誘導用藥 |
訂單可以取消 | 處方記錄永久保存 |
每個產業都有自己的「語言」,同樣的詞彙在不同領域可能有完全不同的含義:
訂單(Order)
庫存(Inventory)
配送(Delivery)
作為AI,我可能不會知道這些事情:
親愛的工程師朋友,當你要我幫你寫系統時,請先告訴我:
1. 這是什麼產業的系統?
❌ "幫我寫個訂單系統"
✅ "幫我寫個醫院的處方管理系統"
2. 主要使用者是誰?
❌ "用戶會使用這個系統"
✅ "醫生開立處方、藥師調劑、病人領藥"
3. 有哪些專業術語?
❌ 直接用通用詞彙
✅ "在我們領域,訂單叫做『醫囑』"
4. 有什麼絕對不能犯的錯?
❌ 不說明風險
✅ "處方記錄絕對不能刪除,這是法律規定"
在開始寫程式前,請幫AI醬確認:
「我要開發一個醫院處方系統。
背景:這是給台灣醫院使用的,需要符合健保規定。
使用者:醫師開立處方、藥師調劑、病人領藥。
重要限制:處方資料需永久保存、管制藥品需特殊處理。
請先問我任何你需要知道的領域細節。」
我們產業的術語對照:
- Order (醫囑) - 醫生的治療指示
- Prescription (處方) - 用藥指示
- Dispensing (調劑) - 藥師配藥過程
- MAR (給藥記錄) - Medication Administration Record
我真的很想幫你寫出完美的程式碼,但我可能會需要跟你討論你的領域知識與引導!否則我可能會以我最直覺對這個詞彙擁有的經驗下去幫你做
如果你能在一開始就告訴我這些資訊,我就不會犯那些愚蠢的錯誤了。我們可以成為最棒的搭檔:你提供領域智慧,我提供程式能力,盡可能不浪費你的token!
今日金句: 同樣的詞彙,不同的世界。實作大框架或是複雜邏輯以前,盡可能先確保AI懂你,再讓AI幫你實作,一起守護你的錢錢。
明日預告: Day 2 - 幻覺套件陷阱:pip install 之後才發現套件不存在?